/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Screen;


import ClassFrame.Button;
import ClassFrame.InputKey;
import ClassFrame.Resource;
import GamePlay.CanvasGame;
import java.util.Vector;
import javax.microedition.lcdui.Graphics;

/**
 *
 * @author QuyetNM1
 */
public class About extends IScreen{
    public Vector v = null;
    
    private Button buttBack;
    
    public About(CanvasGame _canvas) {
        super(_canvas);
        canvas.getRMS().open();
        v = canvas.getRMS().read();
        canvas.getRMS().close();
        
    }
    
    public void initComponents(){
        buttBack = new Button("Quay lại", Resource.IMG_BTN_LT, 155, 285);
        
    }

    public void load_screen() {
        canvas.getResource().loadArray(Resource.aboutArrayImages);
    }

    public void un_load_screen() {
        canvas.getResource().unLoadArray(Resource.aboutArrayImages);
    }

    public void keyEvent(int keycode, int event){
        if(event == InputKey.KEY_EVENT_DOWN){
            if(keycode == InputKey.KEY_RIGHT_SOFTKEY){
                canvas.setScreen( new Menu(canvas));
            }
        }
    }

    public void pointerEvent(int x, int y, int event) {
        switch(event){
             case InputKey.POINTER_EVENT_DOWN:
                 if(canvas.checkButton(x, y, buttBack)){
                    buttBack.setState(Button.HOLD_CLICK);
                canvas.getResource().playSound(Resource.SOUND_BUTTON, 1);
                 }
                 break;
             case InputKey.POINTER_EVENT_UP:
                 if(canvas.checkButton(x, y, buttBack) && buttBack.getState() == Button.HOLD_CLICK){
                    canvas.setScreen( new Menu(canvas) );
                 }
                 buttBack.setState(Button.ENABLE);
                 break;
         }
    }
    
    public void update() {
        
    }

    public void paint(Graphics g) {

        canvas.getImage().drawImage(g, canvas, Resource.IMG_ABOUT, 0, 0);
        buttBack.drawButton(g, canvas);

    }
}
